import React, { Suspense } from 'react';
import { useRoutes } from 'react-router-dom';


const Home = React.lazy(() => import('../views/home'))
const Cart = React.lazy(() => import('../views/cart'))
const Layout = React.lazy(() => import('../views/layout'))


const routes_list = [{
  path: '/',
  element: <Layout></Layout>,
  children: [{
    path: '/',
    element: <Home></Home>
  }, {
    path: '/cart',
    element: <Cart></Cart>
  }]
}]

const RouterView = () => useRoutes(routes_list)
const Router = () => {
  return <Suspense>
    <RouterView></RouterView>
  </Suspense>
} 

export default Router